import { debounce } from 'common/utils'
import BackTop from 'components/content/vackTop/backTop.vue'
import { POP, NEW, SELL } from "./const";
export const itemListenerMixin = {
    data(){
        return{
            itemListen: null

        }
    },
    mounted(){
        const refresh = debounce(this.$refs.scroll.refresh, 50)
        this.itemListen = () =>  refresh() 
        this.$bus.$on('itemImageLoad', this.itemListen)
        // console.log('我是混入中的内容');
    }
}



export const backTopMixin = {
    components:{
        BackTop
    },
    data(){
        return {
            isShow: false,
        }
    },
    methods:{
        backClick() {
            //  console.log('dd');
            // this.$refs.Scroll.scroll.ScrollTo()
            this.$refs.scroll.scrollTo(0, 0,)
        },
        
    },
    
}
export const tabControlMixin = {
    data: function () {
        return {
            currentType: POP
        }
    },
    methods: {
        tabClick(index) {
            switch (index) {
                case 0:
                    this.currentType = POP
                    break
                case 1:
                    this.currentType = NEW
                    break
                case 2:
                    this.currentType = SELL
                    break
            }
            console.log(this.currentType);
        }
    }
}
